//
//  CASystemSettingVC.m
//  CleanerAir_Project
//
//  Created by 付亚杰 on 16/6/27.
//  Copyright © 2016年 Beijing Colin El Internet. All rights reserved.
//

#import "CASystemSettingVC.h"
#import "CAChangePwdVC.h"

@interface CASystemSettingVC ()

@property (weak, nonatomic) IBOutlet UIView *changePwd;

@property (weak, nonatomic) IBOutlet UIView *clearCache;

@property (weak, nonatomic) IBOutlet UIView *pushService;

@property (weak, nonatomic) IBOutlet UIView *aboutMeWill;

@end

@implementation CASystemSettingVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
     self.titlelabel.text = @"系统设置";
    
    [self.changePwd addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changePwds)]];
    [self.clearCache addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clearCaches)]];
    [self.pushService addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushServices)]];
    [self.aboutMeWill addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(aboutMeWills)]];
    // Do any additional setup after loading the view from its nib.
}

- (void)changePwds{
    
    CAChangePwdVC *changePwdVC = [[CAChangePwdVC alloc] init];
    
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:changePwdVC animated:YES];
    
}

- (void)clearCaches{
    [ShowMessage showCenterViewMessage:@"尚未开通"];
}

- (void)pushServices{
    [ShowMessage showCenterViewMessage:@"尚未开通"];
}

- (void)aboutMeWills{
    [ShowMessage showCenterViewMessage:@"尚未开通"];
}

#pragma mark -- 退出登录
- (IBAction)loginOut:(id)sender {
    
    [self showIndicator:@"正在退出，请稍候..."];
    
    NSString *url = [NSString stringWithFormat:@"%@?login_token=%@&member_id=%@",GET_URLString(@"/Api/Member/loginOut"),[LoginSingleton sharedLoginSingleton].token,[LoginSingleton sharedLoginSingleton].loginModel.ids];
    
    __weak __typeof(self) weakSelf = self;
    
    [HTTPManager get:url success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [self hideIndicator];
        if([responseObject[@"msg"] isEqualToString:@"成功"]){
            
            //调用退出方法
            [[LoginSingleton sharedLoginSingleton] loginOut];
            
            [weakSelf.navigationController popToRootViewControllerAnimated:YES];
            
            
        }else{
            [ShowMessage showCenterViewMessage:responseObject[@"msg"]];
        }
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self hideIndicator];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
